<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>

<script src="./jquery.lazyload.js"></script>
<script src="http://unpkg.zhimg.com/jquery"></script>

<!-- 使用格式 -->
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/1.jpg" 
/>
<hr />
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/2.jpg" 
/>
<hr />
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/3.jpg" 
/>
<hr />
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/4.jpg" 
/>
<hr />
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/5.jpg" 
/>
<hr />
<img class="lazy" alt="" width="640" height="480" 
	src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1796411554,1257847298&fm=26&gp=0.jpg" 
	data-original="./imgs/6.jpg" 
/>

<script>
// /* 调用插件*/
// $(function() {
//     $("img.lazy").lazyload();
// });


// 注意: 需要引入jQuery
  // 注意: 需要引入jQuery
function lazyload (){
	$('img').each((i,item)=>{
		let top = $(item).offset().top
		let sTop=$(window).height()+$(document).scrollTop()
		if(top<=sTop){
			let src= $(item).attr( 'data-original' )
			$( item).attr( 'src ',src)
		}
	})
}
let t
lazyload()
$( window) .scroll( function(){
	if(t) return
	t = setTimeout( ()=>{
		lazyload( )
		t = null} ,1000)

})
</script>

